#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use Mangos::DB;
use Mangos::DB::Characters::Characters;

my %db_config = %{YAML::LoadFile('/var/www/vhosts/default/htdocs/wowperl/config.yml')};

my $realm_counter = 1;
foreach my $realm (@{$db_config{realms}}) {
    print "Characters online on: " . $realm->{description} . "\n";
    my $db = Mangos::DB->new(domain => "realm$realm_counter", type => 'characters');
    my $characters = Mangos::DB::Characters::Characters::Manager->get_characters( db => $db, query => [ online => 1 ] );
    foreach my $character (@$characters) {
       print $character->name . "\n";
    }
    $realm_counter++;
}
